/*
 * @Author: Clark
 * @Email: haixuanwoTxh@gmail.com
 * @Date: 2023-07-08 22:23:20
 * @LastEditors: Clark
 * @LastEditTime: 2023-07-15 20:39:19
 * @Description: file content
 */

#include "lcd_api.h"
#include "hzk16.h"
#include <stdio.h>
#include <stdint.h>
// #include <include_bin.h>
// INCBIN(hai, "hai.bin");

int main(int argc, char *argv[])
{
    if (argc < 2)
    {
        printf("Please input hzk\n");
        return -1;
    }

    init_lcd();
    init_hzk(argv[1]);

    #define FONT_SIZE 32

    unsigned char word[3] = {0xBA, 0xA3}; // 海
    // unsigned char word[3] = {0xB7, 0xBC}; // 芳

    // 1、旋转
    // print_hzK_char((char *)get_font_data(word, 16), 16);
    // print_hzk_clockwise_rotate_90((char *)get_font_data(word, 16), 16);
    // print_hzk_anticlockwise_rotate_90((char *)get_font_data(word, 16), 16);

    // 2、16x16
    // lcd_put_chinese(100, 150, get_font_data(word, FONT_SIZE), FONT_SIZE);

    // 3、32x32
    lcd_put_chinese(get_lcd_width()/2, get_lcd_height()/2, get_font_data(word, FONT_SIZE), FONT_SIZE);
    rotate_180_lcd_put_chinese(get_lcd_width()/2, get_lcd_height()/2, get_font_data(word, FONT_SIZE), FONT_SIZE);

    #if 0
    // 显示一个字体
    FILE *fd = fopen(argv[1], "rb+");
    if (fd < 0)
	{
		printf("Can't open hai.bin\n");
        return -1;
	}

    uint32_t fontDataLen = 32*32/8;
    uint8_t fontData[32*32/8] = {0};
    fread(fontData, fontDataLen, 1, fd);    /*从偏移量的位置读取32个字节*/
    fclose(fd);
    lcd_put_chinese(100, 150, fontData, 32);
    #endif
    return 0;
}
